<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 * 
 * 创建时间：2021-11-06 08:59
 *
 * 项目：rm  -  $  - levfmSetHelper.php
 *
 * 作者：liwei 
 */

namespace modules\levfm\helpers;

use Lev;
use lev\base\Viewv;
use lev\controllers\SupermanController;
use lev\helpers\dbHelper;
use lev\helpers\subTableHelper;
use modules\levfm\table\LevfmDatas;
use modules\levfm\table\LevfmDatasChild;
use modules\levfm\table\LevfmForms;

!defined('INLEV') && exit('Access Denied LEV');

class BaseLevfmSet {

    public static function listPageNum() {
        return intval(Lev::stget('listPageNum', 'levfm')) ?: 25;
    }

    public static function closeDzshow() {
        return Lev::stget('closeDzshow', 'levfm');
    }

    /**
     * 分表留白ID长度
     * @return array|string
     */
    public static function startId() {
        return intval(Lev::stget('startId', 'levfm'));
    }

}

class levfmSetHelper extends BaseLevfmSet
{

    /**
     * superman/settings 保存成功回调函数
     * @return array
     *
     * @see SupermanController::actionSettings()
     */
    public static function SettingsReturn() {
        return Lev::responseMsg(1, '--');
    }

    /**
     * @return string
     * @see SupermanController::actionSettings()
     */
    public static function HeaderHtm() {
    }

    /**
     * @return string
     * @see SupermanController::actionSettings()
     */
    public static function FooterHtm() {//Lev::debug();
        if (Lev::GPv('classify') == 2 && is_file($file = dirname(__DIR__) . '/template/renders/superman-settings/footerhtm.php')) {
            $subTabs = subTableHelper::getSubTablesCache();
            $subTabs+= array (
                dbHelper::tableName(LevfmDatas::$tableName) => [
                    [
                        'dataRows' => '-',
                        'startId' => '-',
                        'endId' => '-',
                        'subName' => dbHelper::tableName(LevfmDatas::$tableName),
                    ]
                ],
                dbHelper::tableName(LevfmDatasChild::$tableName) =>[
                    [
                        'dataRows' => '-',
                        'startId' => '-',
                        'endId' => '-',
                        'subName' => dbHelper::tableName(LevfmDatasChild::$tableName),
                    ]
                ],
            );
            return Viewv::renderPartial($file, [
                'subTabs' => $subTabs,
            ]);
        }
        return '';
    }

    /**
     * @return string
     * @see SupermanController::actionSettings()
     */
    public static function FormFooterHtm() {
    }
}